package org.ykx.demo.redis

import java.util.HashSet

import org.apache.commons.pool2.impl.GenericObjectPoolConfig

import redis.clients.jedis.HostAndPort
import redis.clients.jedis.Jedis
import redis.clients.jedis.JedisCluster
import redis.clients.jedis.JedisPool

object RedisClient {
  
  def main(args: Array[String]) {
//    val jedisClusterNodes = new HashSet[HostAndPort]
    
    //Jedis Cluster will attempt to discover cluster nodes automatically
//    jedisClusterNodes.add(new HostAndPort("10.10.61.193", 6379))
//    val jc: JedisCluster = new JedisCluster(jedisClusterNodes)
    val jc = new Jedis("10.10.61.192",6379)
//    jc.set("name", "yakcy")
    println("获取到redis数据： "+jc.get("sebeiID123").foreach { x => println(x) })
//    val StartMoney=jc.get("name")
//    StartMoney.toLong
//    val redisHost = "10.10.61.193"
//    val redisPort = 6379
//    val redisTimeout = 30000
//    lazy val pool = new JedisPool(new GenericObjectPoolConfig(), redisHost, redisPort, redisTimeout)
//    lazy val hook = new Thread {
//      override def run = {
//        println("Execute hook thread: " + this)
//        pool.destroy()
//      }
//    }
//    sys.addShutdownHook(hook.run)


  }
}